
import getlink from "@/apis/getlink.js"
// import getpost from "@/apis/getpost.js"
export let homem = {
    state: {
        newbann: "",
        newfinds: "",
        newdata: "",
        newnavdata: "",
        newnavshai: "",
        newsxs: "",
        newsps: "",
        newsxxxx: ""
    },
    mutations: {
        upsxxxx(state, payload) {
            state.newsxxxx = payload
        },
        upbanner(state, payload) {
            state.newbann = payload
        },
        upnewfind(state, payload) {
            state.newfinds = payload
        },
        upnewdata(state, payload) {
            state.newdata = payload
        },
        upnavdata(state, payload) {
            state.newnavdata = payload
        },
        upnavshai(state, payload) {
            state.newnavshai = payload
        },
        upsxsp(state, payload) {
            state.newsxs = payload.newsx,
                state.newsps = payload.newsp;
        }
    },
    actions: {

        gsxsp(context, payload) {
            getlink(payload.url).then((ok) => {
                // console.log(ok.data.sx);
                // context.commit("upsxsp", { newsx: ok.data.sx, newsp: ok.data.sp })
                context.commit("upsxsp", { newsx: ok.data.sx, newsp: ok.data.sp })
            });
        },

        banlink(context, payload) {
            getlink(payload.url).then((ok) => {
                context.commit("upbanner", ok.data.banner)
            });
        },
        getnewfind(context, payload) {
            getlink(payload.url).then((ok) => {
                // console.log(ok.data.newfind);
                context.commit("upnewfind", ok.data.newfind)
            })
        },
        getnavdata(context, payload) {
            getlink(payload.url).then((ok) => {
                // console.log(ok.data.navdata);
                context.commit("upnavdata", ok.data.navdata)
            })
        },
    

    }
}